An Operational Foundation for Delimited Continuations
نویسندگان
چکیده
We derive an abstract machine that corresponds to a definitional interpreter for the control operators shift and reset. Based on this abstract machine, we construct a syntactic theory of delimited continuations. Both the derivation and the construction scale to the family of control operators shiftn and resetn. The definitional interpreter for shiftn and resetn has n + 1 layers of continuations, the corresponding abstract machine has n + 1 layers of control stacks, and the corresponding syntactic theory has n + 1 layers of evaluation contexts. ∗To appear in the proceedings of the Fourth ACM SIGPLAN Workshop on Continuations (CW’04), January 17, 2004, Venice, Italy. †Basic Research in Computer Science (www.brics.dk), funded by the Danish National Research Foundation. ‡Ny Munkegade, Building 540, DK-8000 Aarhus C, Denmark. Email: {mbiernac,dabi,danvy}@brics.dk
منابع مشابه
An Operational Foundation for Delimited Continuations in the CPS Hierarchy
We present an abstract machine and a reduction semantics for the λ-calculus extended with control operators that give access to delimited continuations in the CPS hierarchy. The abstract machine is derived from an evaluator in continuation-passing style (CPS); the reduction semantics (i.e., a small-step operational semantics with an explicit representation of evaluation contexts) is constructed...
متن کاملThe Theory and Practice of Programming Languages with Delimited Continuations
This dissertation presents a study of functional programming languages with first-class delimited continuations. We focus mainly on theoretical and practical aspects of Danvy and Filinski’s hierarchy of static delimited-control operators shiftn and resetn, and of Felleisen’s dynamic delimited-control operators control and prompt. Our study uses the traditional means of specifying semantics of f...
متن کاملYield: Mainstream Delimited Continuations
Many mainstream languages have operators named yield that share common semantic roots but differ significantly in their details. We present the first known formal study of these mainstream yield operators, unify their many semantic differences, adapt them to to a functional setting, and distill the operational semantics and type theory for a generalized yield operator. The resultant yield, with...
متن کاملPolymorphic Delimited Continuations
This paper presents a polymorphic type system for a language with delimited control operators, shift and reset. Based on the monomorphic type system by Danvy and Filinski, the proposed type system allows pure expressions to be polymorphic. Thanks to the explicit presence of answer types, our type system satisfies various important properties, including strong type soundness, existence of princi...
متن کاملCapturing the Future by Replaying the Past
Delimited continuations are the mother of all monads! So goes the slogan inspired by Filinski’s 1994 paper, which showed that delimited continuations can implement any monadic e ect, letting the programmer use an e ect as easily as if it was built into the language. It’s a shame that not many languages have delimited continuations. Luckily, exceptions and state are also the mother of all monads...
متن کامل